package org.ehe.business.bom.service;

import org.ehe.business.bom.domain.BomMaster;
import org.ehe.business.bom.domain.bo.BomPageBo;
import org.ehe.business.bom.domain.dto.*;
import org.ehe.business.bom.domain.vo.BomPageVO;
import org.ehe.common.mybatis.core.page.PageQuery;
import org.ehe.common.mybatis.core.page.TableDataInfo;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * BOM业务流程服务实现类
 * @author :zhangnn
 * @className :BomBusinessService
 * @description: 整合各个子服务，实现完整的BOM管理业务流程
 * @date 2025-07-30 14:27:20
 */
public interface BomBusinessService {

    /**
     * 分页列表
     * @param bo
     * @param pageQuery
     * @return
     */
    TableDataInfo<BomPageVO> pageBoms(BomPageBo bo, PageQuery pageQuery);

    /**
     * 详情
     * @param bo
     * @param pageQuery
     * @return
     */
    BomPageVO detail(BomPageBo bo, PageQuery pageQuery);

    /**
     * 阶段1：项目启动 & BOM创建 (设计BOM - EBOM)
     * @param request
     * @return
     */
    BomCreationResult saveOrUpdateDesignBom(BomCreationRequest request);

    /**
     * 提交EBOM审批
     * @param bomId
     * @param workflowInstanceId
     */
    BomMaster submitEbomForApproval(Long bomId,Long days,Long workflowInstanceId);

    /**
     * BOM转换 (EBOM -> PBOM -> MBOM)
     * @param request
     * @return
     */
    BomConversionResult convertEbomToMbom(BomConversionRequest request);

    /**
     * BOM变更提交
     * @param request
     * @return
     */
    BomChangeResult submitBomChange(BomChangeRequest request);

    /**
     * 实施BOM变更
     * @param changeLogId
     */
    void implementBomChange(Long changeLogId);

    /**
     * 批量处理bom
     * @param changeLogIds
     * @param operatorId
     * @param operatorName
     * @return
     */
    Map<String, Object> batchProcessBomChanges(List<Long> changeLogIds, Long operatorId, String operatorName);

    /**
     * 生成MRP
     * @param request
     * @return
     */
    MrpResult generateMrp(MrpRequest request);

    /**
     * 生成增强版MRP
     * @param request
     * @return
     */
    MrpResult generateMrpEnhanced(MrpRequest request);

    /**
     * 获取BOM完整信息
     * @param bomId
     * @return
     */
    BomCompleteInfo getBomCompleteInfo(Long bomId);

    /**
     * 获取BOM变更影响分析
     * @param bomId
     * @param changeRequest
     * @return
     */
    Map<String, Object> getBomChangeImpactAnalysis(Long bomId, BomChangeRequest changeRequest);

    /**
     * 处理项目结束
     * @param projectId
     * @param projectEndDate
     */
    void handleProjectClosing(Long projectId, Date projectEndDate);

    /**
     * 审核通过
     * @param bomId
     * @param userId
     * @param code
     */
    BomMaster approveBom(Long bomId, Long userId, String code);

    /**
     * 审批拒绝
     * @param bomId
     * @param rejectReason
     */
    BomMaster rejectBom(Long bomId, String rejectReason);

    /**
     * 删除BOM信息
     * @param ids
     */
    void deleteBomByIds(List<Long> ids);

    BomMaster submitBomDays(BomCreationRequest request);

    /**
     * 完成BOM
     * @param request
     * @return
     */
    BomMaster completeBom(BomCreationRequest request);
}
